package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreBoard;
import com.fujitsu.nanjing.tieba.ibator.CoreBoardCriteria;
import com.fujitsu.nanjing.tieba.ibator.CoreBoardWithBLOBs;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreBoardDAOImpl extends SqlMapClientDaoSupport implements CoreBoardDAO {

    public CoreBoardDAOImpl() {
        super();
    }

    public int countByExample(CoreBoardCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_board.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreBoardCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_board.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer boardid) {
        CoreBoard _key = new CoreBoard();
        _key.setBoardid(boardid);
        int rows = getSqlMapClientTemplate().delete("core_board.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreBoardWithBLOBs record) {
        getSqlMapClientTemplate().insert("core_board.insert", record);
    }

    public void insertSelective(CoreBoardWithBLOBs record) {
        getSqlMapClientTemplate().insert("core_board.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreBoardWithBLOBs> selectByExampleWithBLOBs(CoreBoardCriteria example) {
        List<CoreBoardWithBLOBs> list = getSqlMapClientTemplate().queryForList("core_board.selectByExampleWithBLOBs", example);
        return list;
    }

    @SuppressWarnings("unchecked")
    public List<CoreBoard> selectByExampleWithoutBLOBs(CoreBoardCriteria example) {
        List<CoreBoard> list = getSqlMapClientTemplate().queryForList("core_board.selectByExample", example);
        return list;
    }

    public CoreBoardWithBLOBs selectByPrimaryKey(Integer boardid) {
        CoreBoard _key = new CoreBoard();
        _key.setBoardid(boardid);
        CoreBoardWithBLOBs record = (CoreBoardWithBLOBs) getSqlMapClientTemplate().queryForObject("core_board.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreBoardWithBLOBs record, CoreBoardCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_board.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreBoardWithBLOBs record, CoreBoardCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_board.updateByExampleWithBLOBs", parms);
        return rows;
    }

    public int updateByExample(CoreBoard record, CoreBoardCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_board.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreBoardWithBLOBs record) {
        int rows = getSqlMapClientTemplate().update("core_board.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreBoardWithBLOBs record) {
        int rows = getSqlMapClientTemplate().update("core_board.updateByPrimaryKeyWithBLOBs", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreBoard record) {
        int rows = getSqlMapClientTemplate().update("core_board.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreBoardCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreBoardCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}